<?php

class InputFilter
{
    static public function fetch($var_name, $method = 'post')
    {
        switch ($method)
        {
            case 'post':
                $original_array = $_POST;
                break;
            case 'get':
                $original_array = $_GET;
                break;
            case 'request':
                $original_array = $_REQUEST;
                break;
            case 'session':
                $original_array = $_SESSION;
                break;
        }

        if (isset($original_array[$var_name]))
        {
           $value = trim($original_array[$var_name]);
        }
        else
        {
            $value = null;
        }

        return $value;
    }

    static public function purgeAll()
    {
        unset($_POST);
        unset($_GET);
        unset($_REQUEST);
        unset($_SESSION);
    }
}

?>